﻿<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5shiv.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<![endif]-->
<link rel="stylesheet" type="text/css" href="static/h-ui/css/H-ui.min.css" />
<link rel="stylesheet" type="text/css" href="lib/Hui-iconfont/1.0.8/iconfont.css" />
<link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/H-ui.admin.css" />
<link rel="stylesheet" type="text/css" href="static/h-ui.admin/skin/default/skin.css" id="skin" />
<style type="text/css">
.table>tbody>tr>td{  
        text-align:center;  
}  
/* dataTables表头居中 */  
.table>thead:first-child>tr:first-child>th{  
        text-align:center;  
}  
</style>
<!--[if IE 6]>
<script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title>财务发票</title>
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页
	<span class="c-gray en">&gt;</span>
	财务物流信息
	<span class="c-gray en">&gt;</span>
	财务物流信息查询
  <!--   <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a> -->
</nav>
<div class="page-container">
	<div class="text-c">
		邮寄日期：
		<input type="text" onfocus="WdatePicker({readOnly:true,maxDate:'%y-%M-%d'})" id="logmin" class="input-text Wdate" style="width:110px;">
		<input type="text" name="" id="khm" placeholder=" 客户名" style="width:100px" class="input-text">
		<input type="text" name="" id="kddh" placeholder=" 快递单号" style="width:100px" class="input-text">
		快递公司：
		<span class="select-box inline">
			<select name="" class="select" id="kdgs">
				<option value="0">全部</option>
				<option value="shunfeng">顺丰快递</option>
				<option value="ems">EMS</option>
				<option value="yuantong">圆通快递</option>
			</select>
		</span>
		物流状态：
		<span class="select-box inline">
			<select name="" class="select" id="wlzt">
				<option value="111">全部</option>
				<option value="0">在途</option>
				<option value="1">揽件</option>
				<option value="2">疑难</option>
				<option value="3">签收</option>
				<option value="4">退签</option>
				<option value="5">派件</option>
				<option value="6">退回</option>
				<option value="10">待清关</option>
				<option value="11">清关中</option>
				<option value="12">已清关</option>
				<option value="13">清关异常</option>
				<option value="14">收件人拒签</option>
			</select>
		</span>
		<input type="text" name="" id="jhh" placeholder="SO号、客户PO号、发票号" style="width:200px" class="input-text">
		<button name="" id="find" class="btn btn-success" type="submit"><i class="Hui-iconfont">&#xe665;</i> 搜索</button>
	</div>
	<div class="line mt-10"></div>
	<div class="mt-10">
		<table id="table" class="table table-border table-bordered table-bg table-hover table-sort">
			<thead>
				<tr class="text-c">
					<th width="60">行号</th>
					<th width="180">客户</th>
					<th width="180">参考号</th>
					<th width="120">邮寄日期</th>
					<th width="130">快递公司</th>
					<th width="130">快递单号</th>
					<th width="80">状态</th>
					<th width="120">状态日期</th>
					<th width="30">收件地址</th>
					<th width="30">收件人</th>
					<th width="30">收件人电话</th>
					<th width="30">编辑</th>
					<th width="30">uuid</th>
				</tr>
			</thead>
		</table>
	</div>
</div>
<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript" src="lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="static/h-ui/js/H-ui.min.js"></script> 
<script type="text/javascript" src="static/h-ui.admin/js/H-ui.admin.js"></script> <!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="lib/My97DatePicker/4.8/WdatePicker.js"></script> 
<script type="text/javascript" src="lib/datatables/1.10.0/jquery.dataTables.min.js"></script> 
<script type="text/javascript" src="lib/laypage/1.2/laypage.js"></script>
<script type="text/javascript">
var table;
$(document).ready(function () {
	table=$("#table").DataTable({
		"language": {
            "sProcessing": "处理中...",
            "sLengthMenu": "每页_MENU_条 ",
            "sZeroRecords": "没有匹配结果",
            "sInfo": "显示第 _START_ 至 _END_ 项结果，共 _TOTAL_ 项",
            "sInfoEmpty": "显示第 0 至 0 项结果，共 0 项",
            "sInfoFiltered": "(由 _MAX_ 项结果过滤)",
            "sInfoPostFix": "",
            "sSearch": "搜索:",
            "sUrl": "",
            "sEmptyTable": "表中数据为空",
            "sLoadingRecords": "载入中...",
            "sInfoThousands": ",",
            "oPaginate": {
                "sFirst": "首页",
                "sPrevious": "上页",
                "sNext": "下页",
                "sLast": "末页"
            }
            },
            "aLengthMenu": [40, 100, 200],
            "bAutoWidth": false,
            "bDeferRender": true,
            "bLengthChange": true,
            "sAjaxSource": "find/allInvoice",
            "bPaginate": true,
            "bServerSide": true,
            "bSort": false,
            "iDisplayLength": 40,
            "searching": false,//是否显示搜索框
            "bFilter": true,
            "bProcessing": true,
            "fnServerData":retrieveData,
        	"columns": [
                    {"data": "id"},
    	            {"data": "kh",
    	            	"render": function ( data, type, row, meta ) {  
    	            		return '<div class="text-overflow"  style="width:180px;">'+data+'</div>';
    	            	}
    	            },
    	            {"data": "reference",
    	            	"render": function ( data, type, row, meta ) {  
    	            		return '<div class="text-overflow"  style="width:180px;">'+data+'</div>';
    	            	}
    	            },
    	            {"data": "jhrq"},
    	            {"data": "kdgs",
    	            	 "render": function ( data, type, row, meta ) {  
	       	            	 var da="";	
   	            	 			if(data=='shunfeng'){
	       	            	 		da="顺丰物流";
	       	            	 	}else if(data=='ems'){
	       	            	 		da="EMS";
	       	            	 	}else if(data=='yuantong'){
	       	            	 		da="圆通物流";
	       	            	 	}
                      		 return  da; 	
     		}      
    	            },
    	            {"data": "kddh",
    	             "render": function ( data, type, row, meta ) {  
    	                       return data = '<a onclick="onSelect(this)"><u>' + data + '</u></a>';  	
    	             	}          
    	            },
    	            {"data": "zt",
          	             "render": function ( data, type, row, meta ) {  
			       	            	 var da="";	
		   	            	 			if(data=='null'){
			       	            	 		da="";
			       	            	 	}else{
			       	            	 		da=data;
			       	            	 	}
		                      		 return  da; 	
             		}          },
    	            {"data": "ztrq",
          	             "render": function ( data, type, row, meta ) {  
		          	            	var da="";	
			            	 			if(data=='null'){
		       	            	 		da="";
		       	            	 	}else{
		       	            	 		da=data;
		       	            	 	}
		                   			return  da; 	
             		}          },
             		 {"data": "sjdz","visible": false},
                     {"data": "sjr","visible": false},
                     {"data": "sjrdh","visible": false},
                     {"data": "uuid","render": function ( data, type, row, meta ) {
           					return '<a style="text-decoration:none" class="ml-5" onClick="edit(\''+data+'\')" title="edit"><i class="Hui-iconfont">&#xe60c;</i></a>'; 	
					 }   ,"visible": true},
                     {"data": "uuid","visible": false}
        		]
});
});
function retrieveData(sSource, aoData, fnCallback ) {
	aoData.push(  {"name":"date", "value":$("#logmin").val()}, 
        	{"name":"khm", "value":$("#khm").val()},
            {"name":"kddh", "value":$("#kddh").val()}, 	     
        	{"name":"kdgs", "value":$("#kdgs").val()}, 
            {"name":"jhh", "value":$("#jhh").val()} ,
            {"name":"wlzt", "value":$("#wlzt").val()} 
	);
    $.ajax({
        url : 'find/allInvoice',//这个就是请求地址对应sAjaxSource
        data : aoData,//这个是把datatable的一些基本数据传给后台,比如起始位置,每页显示的行数
        type : 'get',
        success : function(result) {
        	try{
            	fnCallback(result);//把返回的数据传给这个方法就可以了,datatable会自动绑定数据的
        	}catch (e) {
        		layer.msg("身份过期,正在跳转登录界面");
        		setTimeout(function(){window.location.href="login.html"}, 3000);
        		return;
			}
        },
        error : function(msg) {
        	layer.msg("查无数据！");
        	/* layer.confirm('查无数据，是否转直接查询？', {
        		  btn: ['是','否'] //按钮
        		}, function(){
        			var index = layer.open({
        				  type: 2,
        				  title:'实时查询',
        				  area: ['700px', '450px'],
        				  fixed: false, //不固定
        				  maxmin: true,
        				  content:'article-edits2.html',
        				  success: function (layero, index) { 
        					  layer.closeAll('dialog');
        				  }
        			})
        				
        		}, function(){
        		   
        		}); */
        }
    });
}


$("#find").click(function(){
	table.ajax.reload();
}); 

$(document).on('mouseover','.text-overflow',function(){
	layer.tips(jQuery(this).text(),jQuery(this), {
		tips: [2, '#5eb95e'],
		time: 0
		});
});


$(document).on('mouseout','.text-overflow',function(){
		layer.closeAll('tips');
});

var	dh;
var kdgs;
var	dz;
var	xm;
var	sjrdh;
function onSelect(d){
	var rowIndex = $(d).parents("tr").index();  
	//此处拿到隐藏列的值  
	var id = $('#table').DataTable().row(rowIndex).data().uuid;
	kdgs= $('#table').DataTable().row(rowIndex).data().kdgs;
	dh= $('#table').DataTable().row(rowIndex).data().kddh;
	dz= $('#table').DataTable().row(rowIndex).data().sjdz;
	xm= $('#table').DataTable().row(rowIndex).data().sjr;
	sjrdh= $('#table').DataTable().row(rowIndex).data().sjrdh;
 	$.ajax({
           type: "GET",
           url: "find/item",
           data:{"uuid":id},
           dataType: "json",
           success: function(data){
        	   article_edit('快递详情','article-edits.html','10001',data);
           }
	   }); 
}

function article_edit(title,url,id,dataObj){
	var index = layer.open({
		type: 2,
		//area: ['600px', '350px'],
		title: title,
		//fixed: false, //不固定
		//maxmin: true,
		content: url,
		success: function (layero, index) {
			$("#kdgs", layero.find("iframe")[0].contentWindow.document).text(kdgs);
			$("#dh", layero.find("iframe")[0].contentWindow.document).text(dh);
			$("#dz", layero.find("iframe")[0].contentWindow.document).text(dz);
			$("#xm", layero.find("iframe")[0].contentWindow.document).text(xm);
			$("#sjrdh", layero.find("iframe")[0].contentWindow.document).text(sjrdh);
			var v=$("#dd", layero.find("iframe")[0].contentWindow.document);  
			$.each(dataObj.data,function(idx,item){ 
				if(item.ftime!=null){
				  v.append
				  ('<li>'+
						 '<div class="row cl mt-5">'+
							'<div class="col-md-2">'+item.ftime+'</div>'+
							'<div class="col-md-10">'+item.context+'</div>'+
						 '</div>'+
				  '</li>');
				}else{
					v.append
					  ('<li>'+
							 '<div class="row cl mt-5">'+
								'<div class="col-md-12">暂无数据！如有疑问请点击实时查询</div>'+
							 '</div>'+
					  '</li>');
				}
			});
		}
	});
	//最大化窗口
	layer.full(index);
}
function edit(uuid){
	$.post("find/one.json",{uuid:uuid}, function(data){
		if(data!="error"){
			var index = layer.open({
				  type: 2,
				  title:'编辑',
				  area: ['700px', '450px'],
				  fixed: false, //不固定
				  maxmin: true,
				  content:'article-edits3.html',
				  success: function (layero, index) { 
					    var jsonObj = eval('(' + data + ')');
					    var d=jsonObj["KD_COMPANY"];
					    var da="";	
	       	 			if(d=='shunfeng'){
		            	 		da="顺丰物流";
		            	 	}else if(d=='ems'){
		            	 		da="EMS";
		            	 	}else if(d=='yuantong'){
		            	 		da="圆通物流";
		            	 	}
					    $("#uuid", layero.find("iframe")[0].contentWindow.document).val(jsonObj["TRACKING_UUID"]);
					    $("#kh", layero.find("iframe")[0].contentWindow.document).val(jsonObj["CUSTOMER_NAME"]);
					    $("#kdgs", layero.find("iframe")[0].contentWindow.document).val(jsonObj["KD_COMPANY"]);
					    $("#kdgs_cn", layero.find("iframe")[0].contentWindow.document).val(da);
					    $("#kddh", layero.find("iframe")[0].contentWindow.document).val(jsonObj["KD_NO"]);
					    $("#zt option:contains('"+jsonObj["MEANING"]+"')", layero.find("iframe")[0].contentWindow.document).attr("selected",true);
					    $("#qsrq", layero.find("iframe")[0].contentWindow.document).val(jsonObj["RETURN_DATE"]);
					    $("#old_status", layero.find("iframe")[0].contentWindow.document).val(jsonObj["MEANING"]);
					    $("#old_date", layero.find("iframe")[0].contentWindow.document).val(jsonObj["RETURN_DATE"]);
				  },
				end: function () {
					table.ajax.reload();
	            }
			});
		}else{
			layer.msg("无编辑权限或此条物流信息暂不能编辑，请稍后再试！");
		}
	},"text");
}
/* $(function(){
	$.post("find/Role.json", function(data){
		var jsonObj = eval('(' + data + ')');
		alert(sonObj["ROLE"]);
		//if(jsonObj["ROLE"]=='admin')
		table.column(11).visible(false);
	},"text");
}); */
</script> 
</body>
</html>